
var element = layui.element;
var form = layui.form;
var layer = layui.layer;
var $ = layui.jquery;
var table = layui.table;
var data = [
  {
    "id": "1025886",
    "khmc": "陈小明",
    "dlpp": "雅诗兰黛",
    "sqlx": "未授权",
    "sfdj": "省代",
    "tjr": "马晓东",
    "fhr": "吴海梅",
  },
  {
    "id": "1025886",
    "khmc": "陈小明",
    "dlpp": "雅诗兰黛",
    "sqlx": "身份授权",
    "sfdj": "省代",
    "tjr": "马晓东",
    "fhr": "吴海梅",
  },
  {
    "id": "1025886",
    "khmc": "陈小明",
    "dlpp": "雅诗兰黛",
    "sqlx": "身份授权",
    "sfdj": "省代",
    "tjr": "马晓东",
    "fhr": "吴海梅",
  },
  {
    "id": "1025886",
    "khmc": "刘德生",
    "dlpp": "雅诗兰黛",
    "sqlx": "身份授权",
    "sfdj": "省代",
    "tjr": "马晓东",
    "fhr": "吴海梅",
  },
  {
    "id": "1025886",
    "khmc": "刘德生",
    "dlpp": "雅诗兰黛",
    "sqlx": "身份授权",
    "sfdj": "省代",
    "tjr": "马晓东",
    "fhr": "吴海梅",
  },
  {
    "id": "1025886",
    "khmc": "黄秋生",
    "dlpp": "雅诗兰黛",
    "sqlx": "身份授权",
    "sfdj": "省代",
    "tjr": "马晓东",
    "fhr": "吴海梅",
  }
];

table.render({
  elem: '#test',
  cellMinWidth: 80,
  cols: [[
    {type:'checkbox'},
    {field:'id', width:120, title: 'ID'},
    {field:'khmc', width:180, title: '客户名称'},
    {field:'dlpp', width:180, title: '代理品牌'},
    {field:'sqlx', width:180, title: '授权类型', templet: '#sqTemplet'},
    {field:'sfdj', title: '身份等级', minWidth: 100},
    {field:'tjr', title: '推荐人'},
    {field:'fhr', title: '发货人'},
    {field:'cz', title: '操作',minWidth: 180, templet:'#czTemplet'}
  ]],
  data: data
});

/*删除弹框*/
function del(id) {

  layer.confirm('您是否要删除林<b>晓峰旗</b>下的“<b>雅诗兰黛</b>”品牌记录？', {
    skin: 'zp-popup',
    btn: ['删除', '取消'] //按钮
  }, function () {
    //确定删除
    layer.msg('删除成功！', {icon: 1});
  }, function () {
    //取消
  });
}

/*恢复授权弹框*/
function recover(name) {
    layer.confirm('<div class="text-red fs12">您是否要恢复余大师旗下的“'+name+'”品牌授权身份</div><div class="text-title fs12 fw600">1.恢复后，系统将自动恢复所有冻结前临时接替的发货关系至余大师</div>', {
        skin: 'zp-popup',
        title: '授权恢复提示',
        btn: ['进行恢复', '取消'] //按钮
    }, function () {
        //进行恢复
    }, function () {
        //取消
    });
}

function goAuthor() {
  var index = layer.confirm('您当前未创建品牌级别信息，请前往<b class="text-blue">品牌授权</b>进行设置', {
    skin: 'zp-popup',
    btn: ['去设置', '取消'] //按钮
  }, function () {
    //确定
    layer.closeAll();
    window.location.href = '2-品牌授权管理.html';
  }, function () {
    //取消
  });
}

function opentDongjie() {
  layer.open({
    title: '冻结提示',
    skin: 'zp-popup',
    type: 1,
    content: $('#dongjiePopup')
  });
}

function opentZhongzhi() {
    layer.open({
        title: '授权终止提示',
        skin: 'zp-popup',
        type: 1,
        content: $('#zhongzhiPopup')
    });
}

function opentShengji() {
  layer.open({
    area: '600px',
    title: '升级审核',
    skin: 'zp-popup',
    type: 1,
    content: $('#shengjiPopup')
  });
}

$(document).on('click', '#next01', function () {
  //设置升级身份下一步
  $(".step_01").hide();
  $(".step_03").hide();
  $(".step_02").show();
});
$(document).on('click', '#next02', function () {
  //设置升级身份下一步
  $(".step_01").hide();
  $(".step_02").hide();
  $(".step_03").show();
});
$(document).on('click', '#next03', function () {
  //设置升级身份完成
  layer.closeAll();
});

$(document).on('click', '#dongji_btn', function () {
  //冻结
  layer.closeAll();
});



